Learn R Programming

seem (version 1.0)

Nutrient Model Functions: Functions to define ecosystem models for simulation.

Description

Model functions are used as part of argument model to call simulation functions.

Usage

nut.cycle(t,p,x)
nut.cycle.z(t,p,x)
nut.cycle.g(t,p,x,tz)
nut.river(t,p,x)

Arguments

t
time
p
parameters, an array
x
state variable
tz
times of sudden disturbance

Value

  • Model functions: Rate of change or derivative of model.

Details

Function nut.cycle has a function f with the ODE resulting from the multiplication of the matrix k of coefficients by the X vector and the addition of a proportional u input/output (e.g., donor) component and the independent input/output forcing terms U. State varibale is concentration.

Functions nut.cycle.z and nut.cycle.g define discontinuous disturbance regime. Function nut.cycle.z defines times of discontinuities, and nut.cycle.g applies a linear disturbance at tz times defined by nut.cycle.z.

Function nut.river: Nitrogen is controlled by load, which is calculated as discharge over volume, inflow from upstream conditions (when multiplied by flow/volume), and depuration or washout (which is the concentration multiplied by flow/volume).

References

Acevedo M.F. 2012. Simulation of Ecological and Environmental Models. CRC Press.

See Also

Simulation functions sim, simd

Examples

Run this code
# Nitrogen cycle
cycle <- list(f=nut.cycle, z=nut.cycle.z, g=nut.cycle.g)
param <- list(plab="uh",pval=c(-0.5,-0.8))
t.X <- simd(cycle,"chp13/Ncycle-inp.csv",param)

# river no algae no flow and low flow,
river <- list(f=nut.river); param <- list(plab="Q",pval=c(0,0.060,0.600))
t.X <- sim(river,file="chp14/river-no-algae-inp.csv", param, pdfout=TRUE)

Run the code above in your browser using DataLab